import React, { Component } from 'react'
import { NavBar, Icon } from 'antd-mobile'
import './index.scss'
import propTypes from 'prop-types'
import { withRouter } from 'react-router-dom'

class NavHeader extends Component {
  //对children添加校验
  static propTypes = {
    children: propTypes.string.isRequired,
  }
  render() {
    return (
      <div className="navHeader">
        <NavBar
          mode="dark"
          icon={<Icon type="left" />}
          onLeftClick={() => this.props.history.go(-1)}
        >
          {this.props.children}
        </NavBar>
      </div>
    )
  }
}
export default withRouter(NavHeader)
